package com.leetcode.p0;

import com.bean.ListNode;
import com.utils.DataUtils;

public class Test83 {

    public ListNode deleteDuplicates(ListNode head) {
        if (null == head) {
            return null;
        }

        ListNode cur = head;
        while (cur.next != null) {
            if (cur.val == cur.next.val) {
                cur.next = cur.next.next;
            } else {
                cur = cur.next;
            }
        }
        return head;
    }

    public static void main(String[] args) {
        Test83 test = new Test83();
        ListNode head = DataUtils.getListNode(new int[]{1, 1, 1, 4, 4, 5, 6, 6});
        DataUtils.printListNode(test.deleteDuplicates(head));
    }
}
